Mega Code Archive

Categories
1) Android
2) ASP.Net
3) ASP.Net Tutorial
4) C
5) C Tutorial
6) C#
7) C# Book
8) C# by API
9) C# Tutorial
10) C++
11) C++ Tutorial
12) Delphi
13) Flash ActionScript
14) Flex
15) Java
16) Java Book
17) Java by API
18) Java Tutorial
19) JavaScript DHTML
20) JavaScript Reference
21) JavaScript Tutorial
22) MSOfficeExcel 2007 Tutorial
23) MSOfficePowerPoint 2007 Tutorial
24) MSOfficeWord 2007 Tutorial
25) MSSQL
26) MSSQL Tutorial
27) MySQL
28) MySQL Tutorial
29) Oracle PLSQL
30) Oracle PLSQL Tutorial
31) Perl
32) Php
33) PostgreSQL
34) Python
35) Python Tutorial
36) Ruby
37) Silverlight
38) VB.Net
39) VB.Net by API
40) VB.Net Tutorial
41) Visual C++ .NET
42) VisualBasic Script
43) XML
44) XML Tutorial
 
Php
1) Algorithms
2) Authentication
3) Calendar
4) Chart
5) Class
6) Code Snippets
7) Components
8) Content Management
9) Cookie Session
10) Data Type
11) Date Time
12) Design Patterns
13) Development
14) DNS
15) Email
16) File Directory
17) Form
18) Functions
19) Graphics
20) HTML
21) Language Basics
22) Login Authentication
23) Math
24) MySQL Database
25) Network
26) Operator
27) PDF
28) Reflection
29) Searching
30) Site Navigation
31) Statement
32) Statistics and Counters
33) Strings
34) User Management
35) Web Services SOAP WSDL
36) XML
Data Type
1) ++$answer and $answer++
2) A list of numbers using an array variable
3) A Random-Image Script Using array_rand()
4) A stack with type restricted to int
5) Accessing Array Elements
6) Accessing multidimensional array elements
7) Add a PHP block and create a variable that holds a floating-point number
8) Add a PHP block and create a variable that holds an integer
9) Add an Integer value
10) Add elements to the end of an array
11) Add new values to the beginning of the array by using a negative value for $size
12) Add the prefix pts to each array key and then make each variable that results into a reference
13) Add the two integer values and print the result
14) Addendum
15) Adding an Element to the Beginning of an Array
16) Adding an Element to the End of an Array
17) Adding array elements
18) Adding elements with []
19) Adding two integers together
20) Addition of two floating-point variables compared to a variable can lead to an unexpected result
21) Addition of two floating-point variables compared to a variable with the expected value result can lead to an unexpected result.
22) After using asort()to return the arrays elements to their original order
23) Alternating table row colors
24) An array called $computers with numeric and string keys
25) An array called $dinner with numeric keys
26) An array called $vegetables with string keys
27) An array that is padded from the front
28) Appending One Array to Another
29) Apply a user function to every member of an array
30) Applying Functions to Array Elements Using array_map()
31) Applying Functions to Array Elements Using array_walk()
32) Argument Swapping
33) Array and scalar collision
34) Array array_chunk
35) Array Complement
36) Array count value
37) Array element navigation
38) Array filter
39) Array Intersection
40) Array index
41) Array insert
42) Array remove
43) Array shuffle
44) Array to comma string
45) Array to object
46) Array_chunk
47) Array_combine
48) Array_count_values demo
49) Array_count_values() function counts the frequency of the values
50) Array_diff
51) Array_diff( ) function returns a new array containing all the values of array $arr1 that do not exist in array $arr2
52) Array_diff_assoc
53) Array_filter demo
54) Array_filter( ) filters elements through a function
55) Array_flip
56) Array_flip demo
57) Array_flip( ) exchanges all the keys in that array with their matching values
58) Array_flip() example
59) Array_flip() function exchanges all key and element values for the array
60) Array_intersect
61) Array_intersect( ) function returns a new array containing all the values of array $arr1 that exist in array $arr2
62) Array_intersect_assoc
63) Array_key_exists
64) Array_keys
65) Array_keys( ) returns an array of all the keys in that array
66) Array_keys() function returns an array containing all keys
67) Array_merge
68) Array_merge( ) function combines two or more arrays by renumbering numerical indexes and overwriting string indexes
69) Array_merge( ) retains array keys when possible
70) Array_merge() and + operator
71) Array_merge() example
72) Array_merge() function merges 1 to N arrays together
73) Array_merge_recursive
74) Array_multisort
75) Array_multisort for Array Keys with a Given Value
76) Array_pad
77) Array_pad 1
78) Array_pad 2
79) Array_pad 3
80) Array_pad() function expands an array to a precise size, padding it with a default value
81) Array_pop
82) Array_pop( ) returns the value from the end of the array while also removing it from the array
83) Array_push
84) Array_push( ) pushes value onto the end of the array
85) Array_push() function appends one or more values onto the end of the array
86) Array_rand
87) Array_reverse
88) Array_reverse() function reverses the order of the array elements
89) Array_search
90) Array_shift( ) function returns the value from the front of the array while also removing it from the array
91) Array_shift() function operates much like array_pop()
92) Array_slice
93) Array_splice
94) Array_splice() function replaces the designated elements specified by the offset and the optional length input parameters w
95) Array_sum
96) Array_unique( ) filters an array so that a value can only appear once
97) Array_unshift
98) Array_unshift( ) function pushes value onto the start of the array
99) Array_unshift() function shifts the array to the right
100) Array_values
101) Array_values( ) returns an array of all the values in that array
102) Array_values() function returns an array containing all of the values constituting the input array
103) Array_walk() function applies a function to several or all elements in an array
104) Arrays
105) Arrays Demo
106) Arrays Using Associative Array Notation
107) Arsort
108) Arsort( ) function reverse sorts it by its values while preserving the keys
109) Arsort() function maintains the original index association and sorts the elements in reverse order
110) Asort () function retains the arrays keys in the original state
111) Asort( ) function sorts array by its values while preserving the keys
112) Asort() Constants
113) Asort() function
114) Asort() function works in the same way as sort() and preserves the arrays original keyvalue associations
115) Assign an integer value this way
116) Assign elements from array to variables
117) Assigning and Comparing
118) Assigning Array Values
119) Associative Arrays
120) Autogeneration of Array Indexes
121) Bindec
122) Bool empty ( mixed var ) returns true if its parameter has a false value
123) Bool isset ( mixed var [, mixed var [, ]] ) returns true if its parameter has been set
124) Boolean type constant
125) Boolean values
126) Breaking Strings into Arrays with explode()
127) Bubble Sort Variation
128) Building an array of defaults
129) Calculate the area of a circle of given radius
130) Calculating a date interval with epoch timestamps
131) Calculating Discount
132) Casting a Variable
133) Casting the return value
134) Change the data type
135) Changing array values
136) Changing Type by Casting
137) Changing Type with settype()
138) Checking a select menu submission value
139) Checking for a floating point number
140) Checking for a number range
141) Checking for an element with a particular key
142) Checking for an element with a particular value
143) Checking PHPs global authentication variables
144) Checking Whether a Variable Is Set
145) Combining Arrays
146) Compact variables
147) Compare floating-point values,avoid the == operator and use the , , =, and =
148) Comparing Arrays
149) Comparing float values
150) Comparing floating point numbers
151) Compound Interest
152) Concisely reversing a string by word
153) Consider the following block of code
154) Continuously Compounded Interest Calculator
155) Convert String to Date
156) Convert to float
157) Converting an object to an array will convert properties to elements of the resulting array
158) Converting from a boolean to a string will produce a 1 if the boolean is set to true, or an empty string if false
159) Converting to in parentheses before our variable name
160) Count() function can also be used to access certain elements in the array
161) Counting Array Elements
162) Counts all the values of an array with array array_count_values (array input)
163) Create an array
164) Create Object and check its type
165) Create Object and get its type
166) Creates an array that assigns keys 1 through 7 to the days of the week
167) Creates an array with keys 0 through 3
168) Creates an array with keys a, b and c with values of 1, 2 and 3 as well as keys 0, 1 and 2 with values a, b, and c
169) Creating a Multidimensional Array
170) Creating an associative array of shapes
171) Creating Arrays
172) Creating arrays with array()
173) Creating Multidimensional Arrays
174) Creating multidimensional arrays with array()
175) Creating numeric arrays with array()
176) Current
177) Date sort
178) Decbin
179) Dechex
180) Decoct
181) Define Integer, double and string value and output them
182) Defining a Multidimensional Array
183) Deleting an object
184) Demonstrate the Difference Between the Array + Operator and a True Array Union
185) Determining Whether an Element Is in an Array
186) Display an array
187) Display year an individual was born
188) Displaying a multidimensional array
189) Displaying a Multidimensional Array using For each
190) Displaying Multidimensional Arrays
191) Displaying one value from an array
192) Divide the two values and print the result
193) Each() function returns the key-value pair at the current pointer position and moves the pointer to the next element
194) Elements of the enumerated array are numbers
195) End
196) Explode php
197) Explode( ) function converts a string into an array using a separator value
198) Explode() function divides string into various elements, returning these elements in an array
199) Extract a slice of the array
200) Extract( ) function converts elements into variables
201) Extract($points, EXTR_REFSEXTR_PREFIX_ALL, pts)
202) Extract($scores, EXTR_PREFIX_ALL, score)
203) Extracting a Portion of an Array
204) Extracting Values from Arrays with extract()
205) Filtering Arrays Using array_filter()
206) Find the Maximum Value in a Multidimensional Array
207) Finding an element with a particular value
208) Finding the distance between two points
209) Finding the Sum and Average of the Values in an Array
210) Float is converted to an integer before the binary and (&) operation is executed
211) Floating point numbers (doubles) can be specified using any of the following syntaxes
212) Floating-point arithmetic
213) Force a variable into a specific data type
214) Force to change the data type by adding (int), (integer), (float), (double), or (real) in front of the variable
215) Foreach statement is used to loop through an associative array
216) Format an integer and a floating-point value with the number_format() function
217) Formatting currency values
218) Formatting Numbers As Text
219) Formatting with money_format()
220) Function sizeof() returns the number of elements contained in an array
221) Functions for Sorting Arrays
222) Generating an ID with microtime()
223) Generating fixed-width field data records without
224) Get the size of an array in PHP using the count() function
225) Getting and Displaying Counts of Array Values
226) Getting array size
227) Getting the Number of Lines in a File
228) Gettype() and settype() Data Types
229) Hexdec
230) Implode an array to form a string
231) Implode php
232) Implode( ) function converts an array into a string by inserting a separator between each element
233) In_array
234) In_array( ) function return true if an array contains a specific value
235) In_array() function is a control statement
236) Inserting New Values at an Arbitrary Point in an Indexed Array
237) Inserting New Values to an Array
238) Insertion Sort
239) Int value overflow
240) Integer calculation
241) Integer value compare with equal sign
242) Integer values can be signed and unsigned in the range from 2,147,483,648 to 2,147,483,647
243) Integers can be specified using any of the following syntaxes
244) Intersecting two arrays that have no duplicate keys, all the keys will be retained
245) Intval() function
246) Is it an array
247) Is_numeric in action
248) Iterating an Array with foreach and whilelisteach
249) Key
250) Krsort( ) function reverse sorts it by its keys while preserving the values
251) Krsort() function
252) Ksort( ) function sorts array by its keys while preserving the values
253) Ksort() function sorts an array according to its key values, maintaining the original index association
254) List array values
255) Locating Array Elements
256) Looping Through a Compact Indexed Array Using for and count()
257) Looping Through a Multidimensional Array
258) Looping Through a Sparse Array
259) Looping Through an Associative Array with foreach
260) Looping through an Enumerated Array
261) Looping through child elements with foreach()
262) Looping through identically named elements with foreach()
263) Looping Through the $_SERVER Array
264) Looping with foreach()
265) Loops through an indexed array of fruit names and creates a new array with the count of each fruit name
266) Maintaining the integrity of the data and outputting the end result
267) Making a string from an array with implode()
268) Manipulating multidimensional arrays
269) Mixed array_rand ( array arr [, int amount] )
270) Multidimensional array element value interpolation
271) Multiply the two values and print the result
272) Nested array
273) Next
274) Number_format
275) Number_format for English format and Italian format
276) Number_format($n, $p, $t, $d) rounds $n to $p decimal places, using $t as the thousands separator and $d as the decimal separato
277) Number_format($n,$p) rounds $n to $p decimal places, adding commas between thousands
278) Number_format() enables us to determine the precision we require using a second argument
279) Obtaining Array Keys and Values
280) Obtaining Array Keys with a Given Value
281) Obtaining the union of two arrays
282) Octdec
283) One-based array index
284) Operating on array elements
285) Outputting an Array As a String
286) Outputting an Array As a Tree
287) Outputting Using array_values() and array_keys() for Backward Compatibility
288) Pad array to the specified length with a value
289) Parsing fixed-width records with unpack()
290) Pass a second parameter to the sort functions to specify how you want the values sorted
291) PHP Data Types
292) PHP feet-to-meters converter
293) PHP provides a couple of constants especially for use as Booleans
294) Predefined Characters and Classes
295) Print_r
296) Printing a formatted number
297) Printing HTML table rows with implode()
298) Processing variable-length text fields
299) Push one or more elements onto the beginning of array
300) Push one or more elements onto the end of array
301) Queue Handling Library
302) Randomizing an Array Using shuffle(), kshuffle(), and array_rand()
303) Range
304) Range(0,20,2)
305) Reading and Writing Comma-Separated Data
306) Reference Array by index
307) Reference element in multidimensional Arrays
308) Reference the assiciate array element
309) Remove a portion of the array and replace it with something else
310) Remove all elements from positions 3 to (n 3)
311) Remove array elements
312) Remove the fifth and sixth elements from the array
313) Removing Elements
314) Removing Elements from Arrays
315) Removing One or More Arbitrary Array Elements
316) Removing Session Data
317) Removing the First Element of an Array with array_shift()
318) Removing the First or Last Element from an Array
319) Repackage the contents of an array into a delimited string
320) Replace the third and fourth elements with new elements
321) Reset() rewinds the internal pointer of the array back to the first element
322) Return all the keys of an array with array array_keys (array input [, mixed search_value])
323) Return all the values of an array
324) Return an array with elements in reverse order
325) Returns true if $a is a floating-point number
326) Returns true if $a is a string
327) Returns true if $a is an array
328) Returns true if $a is an integer
329) Reversing a string by word
330) Reversing an Array Using array_reverse()
331) Reversing an Array Using arsort()
332) Reversing an Array Using krsort()
333) Rsort php
334) Rsort() function sorts the elements in reverse order
335) Setting an Arrays Size
336) Setting up an associative array is similarly easy
337) Shell Sort
338) Shuffle php
339) Shuffle( ) function randomizes the position of the elements
340) Simple Interest
341) Sort an array in reverse order and maintain index association
342) Sort an associative array on the basis of keys
343) Sort associate array
344) Sort php
345) Sort() function sorts array elements from lowest to highest value
346) Sorting an Array by Its Keys
347) Sorting an Array by Its Values
348) Sorting an Array Using Comparison Functions
349) Sorting Multidimensional Arrays
350) Sorting Multiple Arrays
351) Sorting with arsort()
352) Sorting with asort()
353) Sorting with ksort()
354) Sorting with sort()
355) Specifying Precision
356) Stack Handling Library
357) Stack in Use
358) Storing Floating Point Numbers in PHP
359) Storing Integers in PHP
360) String char count
361) Subtract the two values and print the result
362) Subtracted an Integer value
363) Testing for the Existence of a Key in an Array
364) The count() Function
365) The float is converted to an integer before the binary and (&) operation is executed
366) To get the unique values in an array
367) To reverse sort an enumerated array, use the rsort () function
368) To specify a number in hexadecimal, precede it with 0x
369) Type conversion
370) Type conversions
371) Typecasting
372) Unpacking Values from Binary Data Using unpack()
373) Use asort() to sort by population
374) Use foreach, while and list to loop through associate array
375) Use ksort() to sort by city name
376) Use the index in square brackets to create new elements and or assign values
377) Using array_flip() to return a string back to its original value
378) Using array_map() and array_walk() together
379) Using array_merge() and the + operator with associative arrays as well
380) Using array_pad() with associative arrays
381) Using both the array key and a passed-in value to modify each element value
382) Using count() to Iterate Through an Array
383) Using each() function in conjunction with list()
384) Using explode() with date()
385) Using EXTR_PREFIX_ALL on a numeric array
386) Using extract on an associative array
387) Using extract with the EXTR_PREFIX_ALL directive
388) Using foreach to Iterate through an Array
389) Using sort to alphabetize
390) Using the array function to create an array of weekdays
391) Using the array() Function
392) Using the array_diff () Function
393) Using the array_filter() Function
394) Using the array_intersect () Function
395) Using the array_map() Function
396) Using the array_merge () Function
397) Using the array_push () Function
398) Using the array_remove() function to remove several elements from the beginning and the end of an array
399) Using the array_slice () Function
400) Using the array_unique () Function
401) Using the explode() Function
402) Using the implode() Function
403) Using the isset() function to see whether an array element is defined for a given index
404) Using the sort () Function
405) Using the unset() Function
406) Using typecasting to convert numbers to strings
407) Using uasort() to Sort a Multdimensional Associative Array by One of Its Fields
408) Using uksort() to Sort an Associative Array by the Length of Its Keys
409) Using usort() to Sort a Multidimensional Array by One of Its Fields
410) Using Variable Variables to Create Associations
411) Using_the array_shift () Function
412) Usort() sorts an array based on your own predefined criteria
413) Validating a drop-down menu with array_key_exists()
414) Validating a number with ctype_digit()
415) Viewing the username cookie
416) Void unset ( mixed var [, mixed var [, mixed ]] )
417) When the first expression is a string, the type of the variable will depend on the second expression
418) Working with Unique Values